﻿using ParkSaleForAdmin.Data;

namespace ParkSaleForAdmin
{
    class LocationInfo : IBaseData<LocationInfo>
    {
        public string Name
        {
            get;
            set;
        }
        public string Address
        {
            get;
            set;
        }
        public int Belong
        {
            get;
            set;
        }
        public int ID
        {
            get;
            set;
        }

        public LocationInfo Parse(DatabaseData data)
        {
            ID = int.Parse(data["id"].Value);
            Name = data["name"].Value;
            Address = data["address"].Value;
            Belong = int.Parse(data["belong"].Value);
            return this;
        }
    }
    class LocationWindow : BasicManagerWindow<LocationInfo>
    {
        public override string TableName => "Location";

        protected override string[] values => new string[] { "id", "name", "address", "belong" };

        protected override string[] titles => new string[] { "小区代号", "小区名称", "小区地址", "小区归属企业代号" };

        protected override string[] InputBoxTitle => new string[] { "小区名称", "小区地址", "小区归属企业代号" };

        protected override string[] InputBoxValue => new string[] { "name", "address", "belong" };

        protected override string[] BindingName => new string[] { "ID", "Name", "Address", "Belong" };

        public LocationWindow()
        {

            BeginToCreate();
            Title = "小区管理";
        }
        public override string DeleteStr(LocationInfo obj)
        {
            return $"select * from {TableName} where id = {obj.ID}";
        }

        public override string AppendStr(LocationInfo obj)
        {
            return $"select * from {TableName} where id=99999";
        }

        public override string ChangeStr(LocationInfo obj)
        {
            return $"select * from {TableName} where id = {obj.ID}";
        }
    }
}
